package br.com.lambdacore.validator.impl;

import br.com.lambdacore.validator.Validator;

public class ArrayValidator extends Validator<Object[]> {

	protected ArrayValidator(Object[] object) {
		super(object);
	}

	public boolean empty() {
		Object[] objects = this.getObject();
		boolean nil = true;
		for (Object object : objects) {
			nil = is(object).nil() && nil;
		}
		return nil;
	}

	public boolean hasNull() {
		Object[] objects = this.getObject();
		boolean nil = false;
		for (Object object : objects) {
			nil = is(object).nil() || nil;
		}
		return nil;
	}

	public boolean notEmpty() {
		return !this.empty();
	}

	public static ArrayValidator is(Object[] objects) {
		return new ArrayValidator(objects);
	}
}
